/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.fiap.seguranca.ejb;

import javax.annotation.Resource;
import javax.annotation.security.DenyAll;
import javax.annotation.security.PermitAll;
import javax.annotation.security.RolesAllowed;
import javax.ejb.SessionContext;
import javax.ejb.Stateless;

/**
 *
 * @author osvaldoandrade
 */
@Stateless

@RolesAllowed({"Funcionario", "Gerente"})
public class ClienteService implements ClienteServiceLocal {
    
    @Resource
    private SessionContext context;

    @PermitAll
    public void cadastrar() {
	
	if(context.isCallerInRole("Funcionario")) {
	    System.out.println("---> Funcionario");
	} else {
	    System.out.println("---> Nao sei");
	}
	
    }

    @DenyAll
    public void promover() {
	System.out.println("---> promover() invocado");
    }
}
